#!/bin/sh
# just a simple version of sh_make that has less functionality but no depencies and less size
libsh=${libsh:-${libdir:-/usr/lib}/libsh}
APPDIR=$( dirname $0 )
MODULE_PATH=$APPDIR/../modules
SH_MAKE_VER=2.0
SH_MAKE_REV=30

. $libsh
. $APPDIR/../modules/main_module.in

load_module(){
if echo $loaded_modules | grep -v $( basename $1.in ) ; then
  case "$1" in
  */*)
    . "$1"
    ;;
  *)
    if [ -e $MODULE_PATH/$1 ] ; then
	. $MODULE_PATH/$1.in
    else
      return 1
    fi
    ;;
  esac 
  loaded_modules=$loaded_modules:$( basename $1.in )
else
  return 1
fi

}

if [ "$1" = -f ] ; then
  if [ "$2" = /* ] ; then
     . "$2"
  else
    . "$PWD/$2"
  fi
  shift 2
elif [ -e sh_makefile ] ; then
  . "$PWD/$sh_makefile"

else
  echo "sh_makefile not found or not given by -f"
fi


${1:-default}
